package model

import "gorm.io/gorm"

type Class struct {
	gorm.Model
	ClassName string `gorm:"type:varchar(30);not null;commit:'类别名称'"`
}

func (c *Class) FindFreshByName(db *gorm.DB, name string) error {
	return db.Where("name=?", name).First(c).Error
}

func (c *Class) CreatedClass(db *gorm.DB) error {
	return db.Debug().Create(c).Error

}
